package com.bh.fee.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bh.common.annotation.DataDictClass;
import com.bh.common.constant.Entity;
import com.bh.common.utils.DateUtils;
import com.bh.common.utils.SecurityUtils;
import com.bh.fee.domain.JcOtherCost;
import com.bh.fee.mapper.JcOtherCostMapper;
import com.bh.fee.service.IJcOtherCostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 其他费用登记Service业务层处理
 * 
 * @author slx
 * @date 2023-07-02
 */
@Service
public class JcOtherCostServiceImpl extends ServiceImpl<JcOtherCostMapper, JcOtherCost> implements IJcOtherCostService
{
    @Autowired
    private JcOtherCostMapper jcOtherCostMapper;

    /**
     * 查询其他费用登记
     * 
     * @param id 其他费用登记主键
     * @return 其他费用登记
     */
    @DataDictClass
    @Override
    public JcOtherCost selectJcOtherCostById(Long id)
    {
        return jcOtherCostMapper.selectJcOtherCostById(id);
    }

    /**
     * 查询其他费用登记列表
     * 
     * @param jcOtherCost 其他费用登记
     * @return 其他费用登记
     */
    @DataDictClass
    @Override
    public List<JcOtherCost> selectJcOtherCostList(JcOtherCost jcOtherCost)
    {
        return jcOtherCostMapper.selectJcOtherCostList(jcOtherCost);
    }

    /**
     * 新增其他费用登记
     * 
     * @param jcOtherCost 其他费用登记
     * @return 结果
     */
    @Override
    public int insertJcOtherCost(JcOtherCost jcOtherCost)
    {
        jcOtherCost.setJcOrganizationId(SecurityUtils.getOrgId());
        jcOtherCost.setCreateTime(DateUtils.getNowDate());
        jcOtherCost.setStatus(Entity.ACTIVE);
        return jcOtherCostMapper.insert(jcOtherCost);
    }

    /**
     * 修改其他费用登记
     * 
     * @param jcOtherCost 其他费用登记
     * @return 结果
     */
    @Override
    public int updateJcOtherCost(JcOtherCost jcOtherCost)
    {
        return jcOtherCostMapper.updateById(jcOtherCost);
    }

    /**
     * 批量删除其他费用登记
     * 
     * @param ids 需要删除的其他费用登记主键
     * @return 结果
     */
    @Override
    public int deleteJcOtherCostByIds(Long[] ids)
    {
        return jcOtherCostMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除其他费用登记信息
     * 
     * @param id 其他费用登记主键
     * @return 结果
     */
    @Override
    public int deleteJcOtherCostById(Long id)
    {
        return jcOtherCostMapper.deleteById(id);
    }
}
